{php define('MUI', true);}
{template 'common/header'}
<style>

.input-group, .input-group a {width:100%;}
.help-block img{height:auto; width:100%;}
label{font-weight:300;}
</style>
<div class="mui-content mc-we7-home">
		<div class="mui-banner" style="background-image:url({if !empty($activity['thumb'])}'{$activity['thumb']}'{else}'resource/images/head-bg.png'{/if}); background-repeat:no-repeat;background-size:cover;height:15rem;">
			<div class="setting"><a href="{php echo $this->createMobileUrl('mydayu_form', array('weid' => $_W['uniacid'], 'id' => $reid))}">{$mname}</a></div>
			<img src="{php echo tomedia($profile['avatar']);}" alt="" class="mui-logo mui-img-circle" />
			<div class="mui-banner-info">
			</div>
		</div>
	<form action="{php echo $this->createMobileUrl('dayu_form', array('weid' => $_W['uniacid'], 'id' => $reid))}" class="tab-content clearfix" enctype="multipart/form-data" method="POST" id="form">
	<input type="hidden" name="repeat" value="<?php echo md5(sha1(time())); ?>">
	<div class="mui-input-group mui-mt15">
		<div class="mui-input-row">
			<label>{$activity['member']}:</label>
			<input type="text" name="member" id="member" value="{$member['realname']}"  placeholder="请输入姓名"/>
		</div>
		<div class="mui-input-row">
			<label>{$activity['phone']}:</label>
			<input type="tel" pattern="[0-9]*" name="mobile" id="mobile" value="{$member['mobile']}"  placeholder="请输入手机号"/>
		</div>
	</div>
	<div class="mui-input-group mui-mt15">
	{loop $ds $field}
		{if $field['type'] == 'text'}
		<div class="mui-input-row">
			<label>{$field['title']}:</label>
			<input type="text" name="field_{$field['refid']}_{$field['bind']}" value="{$field['default']}"  placeholder="请填写{$field['title']}"/>
		</div>
		{/if}
		
		{if $field['type'] == 'number'}
		<div class="mui-input-row">
			<label>{$field['title']}:</label>
			<input type="tel" name="field_{$field['refid']}_{$field['bind']}" value="{$field['default']}"  placeholder="请填写{$field['title']}"/>
		</div>
		{/if}
		
		{if $field['type'] == 'textarea'}
		<div class="mui-input-row">
			<label>{$field['title']}:</label>
			<textarea name="field_{$field['refid']}_{$field['bind']}" rows="5" style="height:200px" placeholder="请填写{$field['title']}" {if $field['essential']}required{/if}>{$field['default']}</textarea>
		</div>
		{/if}
		
		{if $field['type'] == 'email'}
		<div class="mui-input-row">
			<label>{$field['title']}:</label>
			<input type="text" name="field_{$field['refid']}_{$field['bind']}" value="{if $field['default']}{$field['default']}{else}@{/if}"/>
		</div>
		{/if}

		{if $field['type'] == 'radio'}
		<div class="mui-input-row">
			<label style="width:100%;">{$field['title']}:</label>
		</div>
			{php $i=1;}
			{loop $field['options'] $v}
			<div class="mui-input-row mui-radio mui-left">
				<label>{$v}</label>
				<input name="field_{$field['refid']}_{$field['bind']}" type="radio" value="{$v}" {if $i==1}checked{/if}>
			</div>
				{php $i++;}
			{/loop}
		{/if}
		
		{if $field['type'] == 'select'}
		<div class="mui-input-row">
			<label style="width:100%;">{$field['title']}:</label>
			<select name="field_{$field['refid']}_{$field['bind']}">
			{loop $field['options'] $v}
			<option value="{$v}" label="{$v}">{$v}</option>
			{/loop}
			</select>
		</div>
		{/if}
		
		{if $field['type'] == 'checkbox'}
		<div class="mui-input-row">
			<label style="width:100%;">{$field['title']}:</label>
		</div>
			{php $i=1;}
			{loop $field['options'] $v}
			<div class="mui-input-row mui-checkbox  mui-left">
				<label>{$v}</label>
				<input name="field_{$field['refid']}_{$field['bind']}[]" type="checkbox" value="{$v}" {if $i==1}checked{/if}>
			</div>
				{php $i++;}
			{/loop}
		{/if}
		
		{if $field['type'] == 'calendar'}
		<div class="mui-input-row">
			<label>{$field['title']}:</label>
			{php echo tpl_app_fans_form('birth', array('year' => $profile['birthyear'], 'month' => $profile['birthmonth'], 'day' => $profile['birthday']), $mcFields['birthyear']['title']);}
		</div>
		{/if}
		
		{if $field['type'] == 'reside'}
		<div class="mui-input-row">
			<label>{$field['title']}:</label>
			{php echo tpl_app_fans_form('reside', array('province' => $profiles['resideprovince'], 'city' => $profiles['residecity'], 'district' => $profiles['residedist']), $mcFields['resideprovince']['title']);}
		</div>
		{/if}
		
		
		{if $field['type'] == 'image'}
		<div class="mui-image-row" style="background-color:#f9f9f9;">
		<div class="mui-table-views mui-table-view-chevrons">
		<div class="mui-table-view-cell">
			<label>{$field['title']}:</label>
				<div class="mui-pull-right">
							{php echo tpl_form_field_image('field_' . $field['refid'] . '_' . $field['bind'], '');}
				</div>
		</div>
		</div>
		</div>
		{/if}
		{/loop}
		</div>
		
	<div class="mui-content-padded">
		<input type="hidden" name="token" value="{$_W['token']}" />
        <button class="mui-btn mui-btn-success mui-btn-block" name="submit" type="submit" id="showTool">{$submitname}</button>
	</div>
	</form>

</div>

<script type="text/javascript">
	$('#form').submit(function(){
       var member = /^[\u4E00-\u9FA5]{1,6}$/;
			if($.trim($(':input[name="member"]').val())=='' || !member.test($.trim($('input[name="member"]').val()))){
				mui.alert("请正确输入姓名", "提示");
				return false;
			}
       var mobile = /^(((13[0-9]{1})|(14[7-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
			if($.trim($(':input[name="mobile"]').val())=='' || !mobile.test($.trim($('input[name="mobile"]').val()))){
				mui.alert("请输入正确的手机号码", "提示");
				return false;
			}
		{loop $ds $field}
		{if $field['essential']}
		{if in_array($field['type'], array('text', 'email'))}
		if($.trim($(':text[name="field_{$field['refid']}_{$field['bind']}"]').val()) == '') {
			mui.alert("{$field['title']} 不能为空", "提示");
			return false;
		}
		{/if}
		{if in_array($field['type'], array('image'))}
		if($.trim($(':input[name="field_{$field['refid']}_{$field['bind']}"]').val()) == '') {
			mui.alert("{$field['title']} 必须上传", "提示");
			return false;
		}
		{/if}
		{if in_array($field['type'], array('textarea'))}
		if($.trim($('textarea[name="field_{$field['refid']}_{$field['bind']}"]').val()) == '') {
			mui.alert("{$field['title']} 必须填写", "提示");
			return false;
		}
		{/if}
		{if in_array($field['type'], array('number'))}
		var num = parseFloat($.trim($(':input[name="field_{$field['refid']}_{$field['bind']}"]').val()));
		if(isNaN(num)) {
			mui.alert('{$field['title']} 必须输入数字.', "提示");
			return false;
		}
		{/if}
		{if in_array($field['type'], array('email'))}
		var mail = $.trim($(':text[name="field_{$field['refid']}_{$field['bind']}"]').val());
		if(!(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/i).test(mail)) {
			mui.alert("{$field['title']} 请正确邮箱地址", "提示");
			return false;
		}
		{/if}
		{/if}
		{/loop}
		return true;
	});
</script>
{template 'footers'}